package com.example.net.oss;


/**
 * Created by Long on 2019/7/8.
 */

public class OSSConfig {
    private String buckName;
    private String url;
    private String endpoint;

    public OSSConfig() {
    }

    public OSSConfig(final String buckName, final String url, final String endpoint) {
        this.buckName = buckName;
        this.url = url;
        this.endpoint = endpoint;
    }

    public String getBuckName() {
        return buckName;
    }

    public void setBuckName(String buckName) {
        this.buckName = buckName;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }

    public static OSSConfig create() {
        String bucket_name = "image-didanuo";
        String endpoint = "oss-cn-shenzhen.aliyuncs.com";
        String aliyun_oss_url = "/api/service/ossSts";
        String stsServer = "http://120.77.237.242:8081" + aliyun_oss_url;
        final OSSConfig ossConfig = new OSSConfig();
        ossConfig.setBuckName(bucket_name);
        //ossConfig.setBuckName("test-image-didanuo");
        ossConfig.setUrl(stsServer);
        ossConfig.setEndpoint(endpoint);
        return ossConfig;
    }

    @Override
    public String toString() {
        return "OSSConfig{" +
                "buckName='" + buckName + '\'' +
                ", url='" + url + '\'' +
                ", endpoint='" + endpoint + '\'' +
                '}';
    }
}
